import dawdreamer


class SimpleDAW:
    def __init__(self, plugin='C:/VstPlugins/64bit/Sylenth1.dll', sample_rate=44100, bpm=120):
        self.engine = dawdreamer.RenderEngine(sample_rate, 256)
        self.instr = self.engine.make_plugin_processor('instr_1', plugin)
        self.engine.load_graph([(self.instr, [])])
        self.engine.set_bpm(bpm)

    def get_params(self, preset_filename=''):
        if preset_filename:
            self.instr.load_preset(preset_filename)
            return (self.instr.get_parameter(i) for i in range(self.instr.get_plugin_parameter_size()))
        else:
            return ()

    def render(self, seconds):
        self.engine.render(seconds)
        return self.engine.get_audio()
